package com.mybatis.study.dao;

import com.mybatis.study.pojo.User;
import org.apache.ibatis.annotations.*;

import java.util.List;

public interface UserMapper {
    @Select("select * from teacher")
    List<User> getUsers();

    // 有多个参数时要加@Param()
    @Select("select * from teacher where id=#{id}")
    User getUserByID(@Param("id") int id2);

    @Insert("insert into teacher(id,name,pwd) values (#{id},#{name},#{pwd})")
    int addUser(User user);

    @Update("update teacher set name=#{name},pwd=#{pwd} where id=#{id}")
    int updateUser(User user);

    @Delete("delete from teacher where id=#{uid}")
    int deleteUser(@Param("uid") int id);
}
